<?php if (!defined('THINK_PATH')) exit();?><!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<meta name="renderer" content="webkit|ie-comp|ie-stand">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
<meta http-equiv="Cache-Control" content="no-siteapp" />
<LINK rel="Bookmark" href="/favicon.ico" >
<LINK rel="Shortcut Icon" href="/favicon.ico" />
<!--[if lt IE 9]>
<script type="text/javascript" src="/Public/Assets/Hui/lib/html5.js"></script>
<script type="text/javascript" src="/Public/Assets/Hui/lib/respond.min.js"></script>
<script type="text/javascript" src="/Public/Assets/Hui/lib/PIE_IE678.js"></script>
<![endif]-->
<link href="/Public/Assets/Hui/css/H-ui.min.css" rel="stylesheet" type="text/css" />
<link href="/Public/Assets/Hui/css/H-ui.admin.css" rel="stylesheet" type="text/css" />
<link href="/Public/Assets/Hui/lib/validator/jquery.validator.css" rel="stylesheet" type="text/css" />
<link href="/Public/Assets/Hui/lib/Hui-iconfont/1.0.1/iconfont.css" rel="stylesheet" type="text/css" />
<link href="/Public/Assets/Miniweb/lib/datepicker/dist/datepicker.min.css" rel="stylesheet" type="text/css" />
<link href="/Public/Assets/Hui/css/pagecss.css?v=1.0.0" rel="stylesheet" type="text/css" />
<link rel="stylesheet" href="/Public/Assets/Hui/lib/zTree/v3/css/zTreeStyle/zTreeStyle.css" type="text/css">
<link rel="stylesheet" type="text/css" href="/Public/Assets/Miniweb/lib/treeTable/treeTable.css" />
<link href="/Public/Assets/Hui/lib/icheck/icheck.css" rel="stylesheet" type="text/css" />
<!--[if IE 6]>
<script type="text/javascript" src="/Public/Assets/Hui/lib/DD_belatedPNG_0.0.8a-min.js" ></script>
<script>DD_belatedPNG.fix('*');</script>
<![endif]-->
<title>编辑角色</title>

<style>
.sortinput {width: 40px;margin-right:10px;}
</style>

</head>
<body>

<div class="pd-20">
	<form action="<?php echo U('Authgroupadmin/edit_post');?>" method="post" class="form form-horizontal validator_form close-dialog">
		<div class="row cl">
			<label class="form-label col-2"><span class="c-red">*</span>角色名称：</label>
			<div class="formControls col-6">
				<input type="text" class="input-text" name="title" value="<?php echo ($info["title"]); ?>" placeholder=""  data-rule="角色名称:required;">
			</div>
		</div>
		<div class="row cl">
			<label class="form-label col-2"><span class="c-red">*</span>角色描述：</label>
			<div class="formControls col-6">
				<textarea class="input-text" name="desc" style="height:60px;" data-rule="角色描述:required;"><?php echo ($info["desc"]); ?></textarea>
			</div>
		</div>
		<div class="row cl">
			<label class="form-label col-2"><span class="c-red">*</span>状态：</label>
			<div class="formControls col-6">
				<?php if(!isset($info['status'])) $info['status'] = 1; ?>
				<div class="radio-box">
				    <label><input type="radio" name="status" value="1" <?php if(($info['status']) == "1"): ?>checked<?php endif; ?>> 启用</label>
				</div>
				<div class="radio-box">
				    <label><input type="radio" name="status" value="0" <?php if(($info['status']) == "0"): ?>checked<?php endif; ?>> 禁用</label>
				</div>
			</div>
		</div>
		<div class="row cl">
			<label class="form-label col-2">网站角色：</label>
			<div class="formControls col-10">
				<?php $groups = C('AUTH_MINI_ROLE_GROUP'); $curgroup = $groups[$_SESSION['auth_role_group']]; $tree = $tree = new \Think\Tree(); $m = M('AuthRule'); $tmp = explode(',',$info['rules']); foreach($tmp as $r){ $rules[$r] = $r; } ?>
				<table class="table" id="treetable">
					<?php if(is_array($curgroup)): $i = 0; $__LIST__ = $curgroup;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$vo): $mod = ($i % 2 );++$i;?><tr>
							<th scope="col" colspan="2"><?php echo ($vo); ?></th>
						</tr>
						<?php $map['group'] = $vo; $datas = $m->where($map)->order('listorder desc')->select(); $tree->init($datas); $treedata = $tree->get_tree_array(0, $str); ?>
						<?php if(is_array($treedata)): $i = 0; $__LIST__ = $treedata;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$tt): $mod = ($i % 2 );++$i; print_table($tt,0,$rules); endforeach; endif; else: echo "" ;endif; endforeach; endif; else: echo "" ;endif; ?>
				</table>
				<?php function print_table($data,$level,$rules){ ?>
				<tr id="node-<?php echo ($data["id"]); ?>" <?php if($data["parentid"] != 0): ?>class="child-of-node-<?php echo ($data["parentid"]); ?>"<?php endif; ?>>
		            <td><span style="margin-left:<?php echo ($level*20); ?>px"></span>└─ <label><input type="checkbox" value="<?php echo ($data["id"]); ?>" name="rule[]" <?php if($rules[$data['id']]) echo 'checked'; ?>><?php echo ((isset($data["title"]) && ($data["title"] !== ""))?($data["title"]):'未设置'); ?></label></td>
		        </tr>
		        <?php if($data['child']){ foreach($data['child'] as $t){ print_table($t,$level+1,$rules); } } ?>
				<?php } ?>
			</div>
		</div>
		<div class="row cl">
			<div class="col-10 col-offset-2">
				<input type="hidden" name="id" value="<?php echo ($info["id"]); ?>">
				<input type="hidden" name="group" value="<?php echo ($_SESSION['auth_role_group']); ?>">
				<button type="submit" style="width:200px;" class="btn btn-success radius" id="admin-role-save" name="admin-role-save"><i class="icon-ok"></i> 确定</button>
			</div>
		</div>
	</form>
</div>


<script type="text/javascript" src="/Public/Assets/Hui/lib/jquery/1.9.1/jquery.min.js"></script>
<script type="text/javascript" src="/Public/Assets/Hui/lib/validator/jquery.validator.js"></script> 
<script type="text/javascript" src="/Public/Assets/Hui/lib/validator/local/zh_CN.js"></script> 
<script type="text/javascript" src="/Public/Sea/modules/layer/2.1/layer/layer.js"></script>
<script type="text/javascript" src="/Public/Assets/Miniweb/lib/datepicker/dist/datepicker.min.js"></script>
<script type="text/javascript" src="/Public/Assets/Miniweb/lib/datepicker/i18n/datepicker.zh-CN.js"></script>
<script type="text/javascript" src="/Public/Assets/Hui/lib/datatables/1.10.0/jquery.dataTables.min.js"></script>
<script type="text/javascript" src="/Public/Assets/Hui/lib/zTree/v3/js/jquery.ztree.all-3.5.min.js"></script> 
<script type="text/javascript" src="/Public/Assets/Miniweb/lib/treeTable/treeTable.js"></script>
<script type="text/javascript" src="/Public/Assets/Hui/js/H-ui.js"></script> 
<script type="text/javascript" src="/Public/Assets/Hui/js/H-ui.admin.js"></script> 
<script type="text/javascript" src="/Public/Assets/Hui/lib/icheck/jquery.icheck.min.js"></script>
<script type="text/javascript" src="/Public/Assets/Miniweb/mini-admin.js"></script> 



<script>

$("#treetable").treeTable({expandable:true,clickableNodeNames:false,childPrefix:'child-of-',treeColumn:0});//treeColumn：0表示表格第二列显示树形结构。但是会影响此表单之后的树形表单显示
</script>

</body>
</html>